package com.Jning.cfengtestdemo.service;

import com.Jning.cfengtestdemo.entity.TestUser;
import com.Jning.cfengtestdemo.repository.TestUserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Cfeng
 * @date 2022/7/27
 * 这里很简单，就不创建接口了，并且只是调用repository
 */

@Service
@RequiredArgsConstructor
public class TestUserService {

    private final TestUserRepository userRepository;

    public List<TestUser> findAll() {
        return userRepository.findAll();
    }

    public TestUser findUserByName(String name) {
        return userRepository.queryTestUserByUserName(name);
    }

    public TestUser registerUser(TestUser user) {
        return userRepository.save(user);
    }
}
